events {}

http {
  upstream Flask {
    least_conn;
	server flask:5000;
  }

  server {
    listen 443 ssl;

	ssl_certificate /etc/ssl/certs/cert.pem;
	ssl_certificate_key /etc/ssl/certs/cert.key;

	ssl_session_cache shared:SSL:10m;
	ssl_session_timeout 5m;
	ssl_ciphers 'HIGH:!aNULL:!MD5';
	ssl_prefer_server_ciphers on;

    location / {
      proxy_pass http://flask;
	  proxy_set_header Host $host;
	  proxy_set_header X-Real-IP $remote_addr;
	  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	  proxy_set_header X-Forwarded-Proto $scheme;
    }
  }

  server {
    listen 80;

	location / {
      return 301 https://$host$request_uri;
    }
  }
}
